package admin_router

import (
	"blog_go/api/admin_api"
	"blog_go/global"
	"blog_go/middleware"
	"github.com/gin-contrib/sessions/redis"
)

func (r adminRouterGroup) AdminUserRouter() {
	store, _ := redis.NewStore(10, "tcp", global.Conf.Redis.Addr(), global.Conf.Redis.Password, []byte("HCHSFOSFJF214J3590FSFMSD"))
	adminUserApi := admin_api.AdminApiGroupApp.AdminUserApi
	r.POST("/email_login", adminUserApi.EmailLogin)
	r.GET("/list", adminUserApi.UserList)
	r.PUT("/update", adminUserApi.UserUpdate)
	r.PUT("/update_pwd", adminUserApi.UpdatePwd)
	r.POST("/logout", adminUserApi.UserLogout)
	r.DELETE("/del", adminUserApi.UserDel)
	r.POST("/bind_email", middleware.SessionHandle(store), adminUserApi.UserBindEmail)
	r.GET("/user_info_token", adminUserApi.UserInfoToken)
	r.POST("/add", adminUserApi.UserAdd)
}
